export function convertTo24Hour(dateTime: any) {
  const datePattern = /(\d{2})\/(\d{2})\/(\d{4})/;
  const timePattern = /(\d{2}):(\d{2}):(\d{2}) (\w{2})/;

  const dateMatch = dateTime.match(datePattern);
  const timeMatch = dateTime.match(timePattern);

  const month = dateMatch[1];
  const day = dateMatch[2];
  const year = dateMatch[3];

  let hours = parseInt(timeMatch[1]);
  const minutes = timeMatch[2];
  const seconds = timeMatch[3];
  const period = timeMatch[4];

  if (period === 'PM' && hours !== 12) {
    hours = hours + 12;
  } else if (period === 'AM' && hours === 12) {
    hours = 0;
  }

  const formattedDateTime =
    year +
    '-' +
    month +
    '-' +
    day +
    ' ' +
    hours.toString().padStart(2, '0') +
    ':' +
    minutes +
    ':' +
    seconds;

  return formattedDateTime;
}
